home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / languages / pcq_incl3v1.lha / Diskfont / DiskFont.i next >
Encoding:
Text File  |  1994-06-12  |  4.2 KB  |  140 lines

  1. {
  2.         DiskFont.i for PCQ Pascal
  3.  
  4.         diskfont library definitions
  5. }
  6.  
  7. {$I   "Include:Exec/Nodes.i"}
  8. {$I   "Include:Exec/Lists.i"}
  9. {$I   "Include:Graphics/Text.i"}
  10.  
  11. Var
  12.     DiskFontBase : Address;
  13.  
  14. Const
  15.  
  16.     MAXFONTPATH         = 256;   { including null terminator }
  17.  
  18. Type
  19.  
  20.     FontContents = record
  21.         fc_FileName     : Array [0..MAXFONTPATH-1] of Char;
  22.         fc_YSize        : Short;
  23.         fc_Style        : Byte;
  24.         fc_Flags        : Byte;
  25.     end;
  26.     FontContentsPtr = ^FontContents;
  27.  
  28.    TFontContents = Record
  29.     tfc_FileName  : Array[0..MAXFONTPATH-3] of Char;
  30.     tfc_TagCount  : Short;       { including the TAG_DONE tag }
  31.     {
  32.      *  if tfc_TagCount is non-zero, tfc_FileName is overlayed with
  33.      *  Text Tags starting at:  (struct TagItem *)
  34.      *      &tfc_FileName[MAXFONTPATH-(tfc_TagCount*sizeof(struct TagItem))]
  35.      }
  36.     tfc_YSize     : Short;
  37.     tfc_Style,
  38.     tfc_Flags     : Byte;
  39.    END;
  40.    TFontContentsPtr =^TFontContents;
  41.  
  42.  
  43. Const
  44.  
  45.     FCH_ID              = $0f00;
  46.     TFCH_ID             = $0f02;  { FontContentsHeader, THEN TFontContents }
  47.     OFCH_ID             = $0f03;  { FontContentsHeader, then TFontContents,
  48.                                     associated with outline font }
  49.  
  50.  
  51. Type
  52.  
  53.     FontContentsHeader = record
  54.         fch_FileID      : Short;        { FCH_ID }
  55.         fch_NumEntries  : Short;        { the number of FontContents elements }
  56.         fch_FC          : Array [0..0] of FontContents;
  57.                                         { actual number of elements is NumEntries }
  58.     end;
  59.     FontContentsHeaderPtr = ^FontContentsHeader;
  60.  
  61. Const
  62.  
  63.     DFH_ID              = $0f80;
  64.     MAXFONTNAME         = 32;   { font name including ".font\0" }
  65.  
  66. Type
  67.  
  68.     DiskFontHeader = record
  69.     { the following 8 bytes are not actually considered a part of the }
  70.     { DiskFontHeader, but immediately preceed it. The NextSegment is  }
  71.     { supplied by the linker/loader, and the ReturnCode is the code   }
  72.     { at the beginning of the font in case someone runs it...          }
  73.     {    ULONG dfh_NextSegment;{ actually a BPTR }
  74.     {    ULONG dfh_ReturnCode;   { MOVEQ #0,D0 : RTS }
  75.     { here then is the official start of the DiskFontHeader...       }
  76.         dfh_DF          : Node;         { node to link disk fonts }
  77.         dfh_FileID      : Short;        { DFH_ID }
  78.         dfh_Revision    : Short;        { the font revision }
  79.         dfh_Segment     : Integer;      { the segment address when loaded }
  80.         dfh_Name        : Array [0..MAXFONTNAME-1] of Char;
  81.                                         { the font name (null terminated) }
  82.         dfh_TF          : TextFont;     { loaded TextFont structure }
  83.     end;
  84.     DiskFontHeaderPtr = ^DiskFontHeader;
  85.  
  86. Const
  87.  
  88.     AFB_MEMORY          = 0;
  89.     AFF_MEMORY          = 1;
  90.     AFB_DISK            = 1;
  91.     AFF_DISK            = 2;
  92.     AFB_SCALED          = 2;
  93.     AFF_SCALED          = $0004;
  94.     AFB_BITMAP          = 3;
  95.     AFF_BITMAP          = $0008;
  96.     AFB_TAGGED          = 16;      { return TAvailFonts }
  97.     AFF_TAGGED          = $10000;
  98.  
  99.  
  100. Type
  101.  
  102.     AvailFont = record
  103.         af_Type         : Short;        { MEMORY or DISK }
  104.         af_Attr         : TextAttr;     { text attributes for font }
  105.     end;
  106.     AvailFontPtr = ^AvailFont;
  107.  
  108.     TAvailFonts = Record
  109.         taf_Type        : Short;           { MEMORY, DISK, OR SCALED }
  110.         taf_Attr        : TTextAttr;       { text attributes for font }
  111.     END;
  112.     TAvailFontsPtr = ^TAvailFonts;
  113.  
  114.     AvailFontsHeader = record
  115.         afh_NumEntries  : Short;        { number of AvailFonts elements }
  116.         afh_AF          : Array [0..0] of AvailFont;
  117.                                         { actual number in NumEntries }
  118.     end;
  119.     AvailFontsHeaderPtr = ^AvailFontsHeader;
  120.  
  121.  
  122.  
  123. FUNCTION AvailFonts(buffer : Address;
  124.                     bufBytes : Integer; types : Integer) : Integer;
  125.     External;
  126.  
  127. Procedure DisposeFontContents(FCH : FontContentsHeaderPtr);
  128.     External; { version 34 }
  129.  
  130. Function NewFontContents(fontsLock : Address { Lock };
  131.                         fontName : String) : FontContentsHeaderPtr;
  132.     External; { version 34 }
  133.  
  134. FUNCTION NewScaledDiskFont(srcFont : TextFontPtr; destTextAttr : TTextAttrPtr) : DiskFontHeaderPtr;
  135.     External;
  136.  
  137. Function OpenDiskFont(TA : TextAttrPtr) : TextFontPtr;
  138.     External;
  139.  
  140.